import os
import subprocess
import sys
print("  _____                                  _   _             _    ")
print(" / ____|                                | | | |           | |   ")
print("| (___   ___ _ ____   _____ _ __    __ _| |_| |_ __ _  ___| | __")
print(" \___ \ / _ \ '__\ \ / / _ \ '__|  / _` | __| __/ _` |/ __| |/ /")
print(" ____) |  __/ |   \ V /  __/ |    | (_| | |_| || (_| | (__|   < ")
print("|_____/ \___|_|    \_/ \___|_|     \__,_|\__|\__\__,_|\___|_|\_\\")
print("\033[1;32;40m[*]服务器攻击是指针对服务器的恶意行为，旨在通过大量合法或非法请求来压倒服务器，从而超出其容量，并使其无法为合法用户提供正常服务。")
print("\033[1;37;40m")

files = {
    1: {"name": "ddos_cn/Server_attack/Cache_Server_Attack.py", "description": "缓存服务器攻击"},
    2: {"name": "ddos_cn/Server_attack/Minecraft_server_DDoS.py", "description": "Minecraft服务器DDoS"},
    3: {"name": "ddos_cn/Server_attack/translation_server_ddos.py", "description": "翻译服务器DDoS"},
}

def run_python_file(file_number):
    if file_number in files:
        file_info = files[file_number]
        file_name = file_info["name"]
        file_description = file_info["description"]
        if os.path.exists(file_name) and file_name.endswith('.py'):
            print("ok")
            subprocess.run([sys.executable, file_name])
        else:
            print("错误：文件不存在。")
    else:
        print("错误：无效的选择。")

def main():
    print("请选择攻击模式：")
    for num, file_info in files.items():
        print(f"[{num}] {file_info['description']}")
    choice = int(input("请输入数字："))
    run_python_file(choice)

if __name__ == "__main__":
    main()
    
#sansjtw https://sansjtw.xyz https://github.com/sansjtw